/*
 * @Descripttion: 自定义按钮, 常用按钮
 * @version: 
 * @Author: jwZhang
 * @Date: 2020-05-10 16:28:11
 * @LastEditors: jwZhang
 * @LastEditTime: 2020-05-10 16:38:45
 */

import 'package:flutter/material.dart';

class QButton extends StatelessWidget {
  final VoidCallback onClick;
  final String title;
  final double width;
  final double height;
  final double fontSize;
  final double borderRadius;
  final Color textColor;
  final Color backgroundColor;

  QButton(
      {@required this.onClick,
      @required this.title,
      this.width = 250,
      this.height = 50,
      this.fontSize = 18,
      this.borderRadius,
      this.textColor = Colors.white,
      this.backgroundColor = Colors.red});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width,
      height: height,
      child: RaisedButton(
        onPressed: onClick,
        color: backgroundColor,
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(borderRadius == null
                ? Radius.circular(height / 2)
                : borderRadius)),
        child: Text(
          title,
          style: TextStyle(color: textColor, fontSize: fontSize),
        ),
      ),
    );
  }
}
